The present invention relates to a distance measuring apparatus and method for measuring the distance to an object to be measured and, for example, a distance measuring apparatus and method suitably applied to an automatic focusing mechanism of a camera.
Conventionally, a distance measuring device which performs trigonometrical measurement by projecting a light spot onto an object to be measured and receiving light reflected by the object using a position detection means such as a position sensitive detector (PSD) or the like is known. Further, another distance measuring device which circulates an accumulated charge using a ring-shaped charge transfer device, such as CCD, to integrate reflected light of ON/OFF-projected light spots and skims a predetermined amount of charges of external light components other than the light spot has been proposed by Japanese Patent Publication No. 5-22843 and Japanese Patent Application Laid-Open No. 8-233571. The distance measuring device of this type can keep accumulating charges while circulating the accumulated charge if the level of the accumulated charge is not high enough, thereby it is possible to obtain signals of good S/N ratio.
Further, a method for measuring a shift amount of two images of an object of interest received by two ring-shaped CCDs having the above configuration, and measuring a distance to the object on the basis of the measured shift amount is proposed in Japanese Patent Application Laid-Open No. 9-105623. The aforesaid distance measuring devices are often used in an automatic focusing mechanism of a camera.
First, the Japanese Patent Publication No. 5-22843 is explained below.
FIG. 21 is a diagram illustrating a configuration of a light-receiving unit used in a distance measuring apparatus.
Note, in FIG. 21, a photoelectric conversion (photo-receiving) device 520 of a light-receiving unit 500 is represented by three photoelectric conversion devices X, Y and Z, to simplify the explanation.
The light-receiving unit 500 operates in two different modes, namely, an active mode and a passive mode.
The active mode is to project light onto an object 515 to be measured, the distance to which is to be measured, by turning on and off a light emit element (here, infrared light-emitting diode; IRED) 514 to emit light pulses, receive light reflected by the object using the photoelectric conversion devices X, Y and Z, and store the charges. Whereas, the passive mode is to receive external light reflected by the object without turning on the IRED 514 using the photoelectric conversion devices X, Y and Z, and store the charges.
The distance measuring apparatus is of a hybrid-type capable of performing distance measuring operation both in the active mode and in the passive mode, and, when a reliable measurement result is not obtained in the active mode, then the distance is measured once again in the passive mode.
Further, the light-receiving unit 500 has a linear CCD 524 which includes ON-pixels 522x, 522y, and 522z and OFF-pixels 523x, 523y, and 523z, respectively corresponding to the photoelectric conversion devices X, Y and Z, and a ring-shaped CCD 521 which includes a plurality of ON-pixels and OFF-pixels.
Therefore, the charges obtained as a result of photoelectric conversion in the photoelectric conversion devices X, Y and Z are respectively transferred to the corresponding ON-pixels and OFF-pixels of the linear CCD 524 and stored, thereafter, transferred to the ring-shaped CCD 521.
Next, timing of charge transfer operation in the light-receiving unit 500 is explained with reference to FIG. 22.
Referring to FIG. 22, the IRED 514 turns on and off in synchronization with the ON/OFF (High/Low) of a charging signal in the active mode, and the IRED 514 is kept off independent of the ON/OFF of the charging signal in the passive mode.
First, charges obtained in the photoelectric conversion devices X, Y and Z while the charging signal is ON (i.e., High level) are transferred to the ON-pixels 522x, 522y, and 522z while an ON-pixel transfer signal is ON (i.e., High level).
Further, charges obtained in the photoelectric conversion devices X, Y and Z while the charging signal is OFF (i.e., Low level) are transferred to the OFF-pixels 523x, 523y, and 523z while an OFF-pixel transfer signal is ON (i.e., High level).
In this manner, charges due to projected light reflected by the object and external light are stored in the ON-pixels 522x, 522y, and 522z, while charges due to external light are stored in the OFF-pixels 523x, 523y, and 523z in the active mode.
After the charges obtained in the photoelectric conversion devices X, Y and Z are transferred to the ON-pixels 522x, 522y, and 522z and the OFF-pixels 523x, 523y, and 523z, the charges are transferred to the ring-shaped CCD 521.
To transfer the charges to the ring-shaped CCD 521, a ring transfer signal is used. The ring transfer signal becomes High so that charges from the same pixel of the linear CCD 524 are always transferred to the same pixel of the ring-shaped CCD. Accordingly, charges outputted from the ON-pixel 522x, corresponding to the photoelectric conversion element X obtained during the charging signal is ON, for example, are accumulated.
In FIG. 22, the numerals 1, 2, 3, and so on, indicate the number of circulation. The number of circulation indicates the number of times charges are transferred to the ring-shaped CCD 521.
More specifically, in the first circulation, charges are transferred to the ring-shaped CCD 521 once, as shown in FIG. 23A, and the charges obtained in one charging operation are stored. In the second circulation, charges obtained in two charging operations are accumulated, as shown in FIG. 23B, and in the third circulation, charges are transferred to the ring-shaped CCD 521 three times; in other words, three charging operations are performed and charges obtained in the three charging operations are accumulated in the respective pixels, as shown in FIG. 23C.
When the charges accumulated in the ring-shaped CCD 521 do not reach a predetermined level (level in which distance measurement can be performed on the basis of the charges), i.e., incoming light to the photoelectric conversion devices X, Y and Z is low, the number of circulation, i.e., the number of charging operation, is increased, and the charges are sequentially transferred to the ring-shaped CCD 521 and accumulated until charges are accumulated to the necessary (predetermined) level. In this manner, it is possible to obtain charges of good S/N ratio.
Whereas, in a case where an amount of charge in the ring-shaped 521 succeeds a predetermined level within a predetermined times of circulation, i.e., in a case where incoming light to the photoelectric conversion devices X, Y and Z is high, it is necessary to adjust the amounts of charges to be stored in the pixels of the linear CCD 524 in one charging operation in order to prevent the pixels from being saturated.
As for adjusting the amounts of charges, there are a method of adjusting a charging period by controlling an electrical shutter function, and a method for controlling a frequency for operating the photoelectric conversion devices X, Y and Z, thereby controlling a charging period.
More specifically, in the method of adjusting the charge amounts by controlling the electrical shutter function, if a reference charging period is 100%, then the charging period is reduced to 70%, 50%, and so on, when the object 515 is bright.
Further, in the method of adjusting the charge amount by controlling the frequency for operating the photoelectric conversion devices X, Y and Z, if any of the ON-pixels 522x, 522y, and 522z and the OFF-pixels 523x, 523y, and 523z is saturated when the photoelectric conversion devices X, Y and Z are operated at 1 MHz, then by operating the photoelectric conversion devices X, Y and Z in the doubled frequency, namely at 2 MHz, it is possible to halve the duration of the charging period without changing other charging conditions.
By adjusting the amount of charge as described above, the pixels of the linear CCD 524 are prevented from being saturated.
FIG. 24 is a flowchart showing distance measuring operation when the aforesaid distance measuring apparatus is applied to an automatic focusing (AF) function of a camera which deals with a variety of objects ranging from an object of high reflectance at a short distance to an object of low reflectance in the distance.
First, when the AF function is activated, the active mode is set in step S602; thereby distance measuring operation is performed in the active mode, first.
Next, whether the current mode is the active mode or the passive mode is determined in step S603.
If it is determined that the current mode is the active mode in step S603, then an operation frequency fc for operating the photoelectric conversion devices X, Y and Z is set to 500 kHz as an initial value in step S604. Whereas, if it is determined that the current mode is the passive mode in step S603, then the operation frequency fc is set to 1 MHz as an initial value in step S605.
After setting the initial operation frequency either in step S604 or S605, then ICG (Integration Clear Gate) mode is executed in step S606.
The ICG mode is to determine charging conditions (e.g., setting of electronic shutter and operation frequency) so that any of the OFF-pixels 523x, 523y, and 523z is not saturated by external light while accumulating charges.
Next in step S607, whether or not the external light is too bright to prevent the OFF-pixels 523x, 523y, and 523z from being saturated under the charging conditions determined in step S606 (saturation due to external light) is judged.
For example, if the set value of the electronic shutter is the minimum and any of the accumulated charges exceeds a predetermined level within the predetermined number of circulation, then it is determined that the charging period can not be shortened any further by controlling the electronic shutter, and that saturation due to external light occurred.
If it is determined that saturation due to external light occurred in step S607, the process proceeds to step S612, which will be explained later.
Whereas, if it is determined in step S607 that saturation due to external light did not occur, then the integration mode is executed in step S608. In the integration mode, charges are accumulated in the ring-shaped CCD 521.
A period elapsed while accumulating charges is known from the number of circulation and the operation frequency fc stored in advance.
After finishing accumulating charges in the ring-shaped CCD 521, whether or not any of the ON-pixels 522x, 522y, and 522z is saturated is determined in step S609. This determination is performed in the same manner as described in step S607.
If it is determined that any of the ON-pixels 522x, 522y, and 522z is saturated, then the process proceeds to step S612 which will be explained later.
Whereas, if it is determined in step S609 that none of the ON-pixels 522x, 522y, and 522z is saturated, then read-out mode is executed in step S610. The read-out mode is to read out charges accumulated in the ring-shaped CCD 521.
The charges read out from the ring-shaped CCD 521 in the read-out mode are provided to a CPU (not shown), for instance, and distance measuring operation for obtaining the distance to the object 515 is performed in step S611. The distance measuring operation performed in step S611 is a correlation operation, and two images, having parallax, are shifted so as to coincide with each other, then the shifted amount is obtained. The distance to the object is obtained on the basis of the shifted amount. This correlation operation is based on the phenomena that correlation relationship between the two images changes depending upon the distance to the object. Thereafter, the process proceeds to step 612.
In step S612, whether the current mode (distance measuring mode) is the active mode or the passive mode is checked.
If it is determined as the active mode in step S612, then the process proceeds to step S614 where whether the distance measuring operation has completed normally (OK) or with any trouble (NG) is determined. In a case where any of the ON-pixels 522x, 522y, and 522z and the OFF-pixels 523x, 523y, and 523z is determined as saturated in step S607 with external light or in step S609, then the distance measuring operation is considered as NG, and the passive mode is set in step S615. Thereafter, the process returns to step S603, and the processes subsequent to step S603 are performed again.
Whereas, if it is determined in step S614 that the distance measuring operation has completed normally, then the result of distance measuring operation obtained in step S611 is adopted, and the process is completed. Further, if it is determined in step S612 that the current mode is the passive move, then the result of distance measuring operation obtained in step S611 is adopted, and the process is completed.
Next, the principle of the correlation operation performed in step S611 is briefly explained with reference to FIG. 25A to FIG. 27.
When the signals of the two images are signals of right and left images obtained from two circulating-type shift registers 500 arranged on the image surface (referred to as "right signal pattern" and "left signal pattern", respectively, hereinafter) and an object is in the distance, the right signal pattern and the left signal pattern appear at about the same position as shown in FIG. 25A. As the position of the object approaches to the measuring position, the phase difference between the right signal pattern and the left signal pattern increases as shown in FIGS. 25B and 25C.
When two signal patterns as shown in FIG. 26A are obtained, conjunction between the two signal patterns with respect to shifted amount when at least one of the two signal patterns is shifted is as shown in FIG. 26B.
FIG. 27 is a flowchart briefly showing correlation operation. When the correlation operation for distance measuring operation starts in step S901, then a shift amount, Ms, of shifting a signal pattern is set to a start shift amount in step S902, and an end shift amount, Me, is set in step S903. Next in step S904, necessary initialization of RAM is performed. Note, Smin (will be explained later) is initialized to a sufficiently large value in step S904.
Next in step S905, the right signal pattern is shifted to the left by Ms, and a conjunction S between the right signal pattern and the left signal pattern is calculated in step S906. When the conjunction obtained in step S906 is plotted with respect to the shift amount, as shown in FIG. 26B, it is known that a shift amount corresponding to the minimum value of the conjunction represents a position where the right signal pattern coincides with the left signal pattern. Therefore, in step S907, comparison for holding the minimum value, Smin, of the conjunction between the right and left signal patterns is performed. If the conjunction S calculated in step S906 is smaller than the current minimum value Smin (Yes in step S907), then the process proceeds to step S908 where the value of Smin is replaced by the value of S. Further, the shift amount Ms corresponding to the conjunction S is stored as a variable M in step S909, and the process proceeds to step S910.
Whereas, if it is determined in step S907 that the conjunction S obtained in step S906 is equal to or greater than Smin, then the process directly proceeds to step S910.
In step S910, the shift amount Ms is increased by 1, and whether or not the increased shift amount Ms exceeds the end shift amount Me is checked in step S911. If Ms does not exceed Me, then the process returns to step S905 and the same processes as described above are performed. Whereas, if Ms exceeds Me, then the process proceeds to step S912 and the correlation operation is completed. As for the result of the correlation operation, the distance to the object is known from the variable M (the shift amount where the conjunction between the right and left signal patterns is minimum) stored in step S909.
In the aforesaid correlation calculation performed for distance measuring operation in order to deal with a variety of objects ranging from an object at a short distance to an object in the distance, since the shift amount is small when the object is at a long distance, whereas the shift amount is large when the object is at a short distance and there is no means for knowing the distance to the object before performing the correlation operation, it is necessary to perform correlation operation for all the shift amounts in a wide shift range. This requires considerable time.
Next, a distance measuring apparatus, as disclosed in the Japanese Patent Application Laid-Open No. 9-105623 is explained with reference to FIG. 28. The distance measuring apparatus has two photo-sensing systems which perform skimming operation, and obtains a distance to an object on the basis of a phase difference between two images obtained from the two photo-sensing systems.
Referring to FIG. 28, reference numeral 2801 denotes a first light-receiving lens for forming a first optical path; 2802, a second light-receiving lens for forming a second optical path; 2803, a projection lens for projecting a beam spot onto the object to be measured; and 2804, a light-emitting element (IRED) which is turned on/off to project beam spots. Reference numeral 2805 denotes a first sensor array as a linear array of a plurality of photoelectric conversion elements (pixels); 2806, a second sensor array as a linear array of a plurality of photoelectric conversion elements; and 2807, a first clear portion which provides an electronic shutter function of clearing charges photoelectrically converted by the respective photoelectric conversion elements of the first sensor array 2805. The first clear portion 2807 clears charges in response to pulses ICG (Integration Clear Gate). Reference numeral 2808 denotes a second clear portion which provides an electronic shutter function of clearing charges photoelectrically converted by the respective photoelectric conversion elements of the second sensor array 2806. The second clear portion 2808 clears charges in response to pulses ICG as in the first clear portion 2807.
Reference numeral 2809 denotes a first charge accumulation portion which includes ON and OFF accumulation portions (not shown) and accumulates electric charges obtained from the first sensor array 2805 synchronous with the ON and OFF periods of the light-emitting element 2804 in units of pixels in accordance with pulses ST (storage) 1 and ST2. Reference numeral 2810 denotes a second charge accumulation portion which accumulates charges obtained from the second sensor array 2806 synchronous with the ON and OFF periods of the light-emitting element 2804 in units of pixels in accordance with pulses sT1 and ST2, as in the first charge accumulation portion 2809. Reference numeral 2811 denotes a first charge transfer gate for parallelly transferring electric charges accumulated in the first charge accumulation portion 2809 to a charge transfer unit (e.g., a CCD; to be described below) in response to pulses SH. Reference numeral 2813 denotes a first charge transfer unit, which is locally or entirely constituted by a ring-shaped arrangement, and sums up charges respectively accumulated by the first charge accumulation portion 2809 during the ON and OFF periods by circulating charges. The circulating portion will be referred to as a ring CCD hereinafter. Reference numeral 2812 denotes a second charge transfer gate, which has the same arrangement as that of the first charge transfer gate 2811. Reference numeral 2814 denotes a second charge transfer unit, which has the same arrangement as that of the first charge transfer unit 2813.
Reference numeral 2815 denotes a first initialization unit, which performs initialization by resetting charges in the first charge transfer unit 2813 in response to pulses CCDCLR. Reference numeral 2816 denotes a second initialization unit, which performs initialization by resetting charges in the second charge transfer unit 2814 in response to pulses CCDCLR similarly to the first initialization unit 2815. Reference numeral 2817 denotes a first skim unit for discharging a predetermined amount of charges. Reference numeral 2818 denotes a second skim unit having the same function as that of the first skim unit 2817. Reference numeral 2819 denotes a first output unit for outputting a signal SKOS1 which is used for discriminating whether or not a predetermined amount of charges is to be discharged. The first output unit 2819 reads out the charge amount present in the first charge transfer unit 2813 in a non-destructive manner while leaving them as charges. Reference numeral 2820 denotes a second output unit for outputting a signal SKOS2 as in the first output unit 2819. Reference numeral 2821 denotes an output unit for sequentially reading out charges in the first charge transfer unit 2813 and outputting a signal OS1. Reference numeral 2822 denotes an output unit for outputting a signal OS2 in accordance with charges from the second charge transfer unit 2814 as in the output unit 2821. Reference numeral 2823 denotes a first converter which operates on the basis of the signal SKOS1; and 2824, a second converter which operates on the basis of the signal SKOS2. Reference numeral 2825 denotes a control unit including a microcomputer for making the overall control and calculations.
FIGS. 29A and 29B respectively show image information obtained by amplifying and quantizing the output signal OS1 from the first sensor array 2805 and the output signal OS2 from the second sensor array 2806 (called "signal pattern A" and "signal pattern B", respectively).
In the image information of the signal pattern A and the signal pattern B, signal levels corresponding to pixels (photoelectric conversion elements), where an image of the object is not formed, of the first and second sensor arrays 2805 and 2806 are zero. In this apparatus, the distance to the object is measured by determining the phase difference between the two image information. As for methods of determining the phase difference, there is a method in which at least one of the two image information is shifted bit by bit within a predetermined shift range, a correlation value is calculated each time the image information is shifted by a bit, and a shifted amount of the image information when the pair of image information coincide with each other is detected. The correlation value, COR, is obtained in accordance with the following equations. ##EQU1##
where,
IA(n): Image information of the n-th pixel of the signal pattern A PA1 IB(n): Image information of the n-th pixel of the signal pattern B PA1 cs: Shifted amount PA1 cp: Number of pixels subjected to correlation operation PA1 MA: Rate of change in correlation value of the most reliable occasion among occasions when the correlation value crosses the y=0 coordinate line, where the y axis represents correlation value PA1 JB: Absolute value of a correlation value just before crossing the y=0 coordinate line PA1 ZR: Shifted amount corresponding to the correlation value just before crossing the y=0 coordinate line PA1 LS: Correlation value with the previous shifted amount PA1 CS: Shift amount. The start shift amount is SB in bit and the end shift amount is SE in bit. PA1 CP: Number of pixels subjected to correlation operation PA1 NPX: Number of pixels of the sensor array PA1 COR1: First term of the equation (1) PA1 COR2: Second (last) term of the equation (1)
The number of pixels, cp, is obtained as: EQU cp=(the number of pixels of the sensor) -(absolute value of a shifted amount) -(constant)
FIG. 30 is a flowchart when calculating a correlation value for each shifted amount in a case where image data as shown in FIGS. 29A and 29B are obtained.
First, in steps S701 and S702, the initialization of variables are performed. In steps S701 and S702,
In subsequent steps S703 to S705, the start addresses PA and PB of the image information subjected to correlation operation are set in accordance with the sign (either positive or negative) of the shift amount. In the subsequent steps S706 to S715, calculation defined by the equation (1) is performed. More specifically, sums (COR1 and COR2) are obtained for a given shifted amount, and in next step S715, the correlation value COR which is the difference between the sums (COR1 and COR2) is calculated. Then, a point where the correlation value COR crosses the y=0 coordinate line (called "zero-cross point" hereinafter) is detected in subsequent steps S716 and S721. For instance, if the correlation value obtained in a given loop is greater than 0 (step S716) and the correlation value obtained in the previous loop is less than 0 (step S717), then it means that the correlation value crosses the y=0 coordinate line. Then, a rate of change DE of the correlation value at the zero cross point is calculated. In a case where a plurality of zero cross points exist, if the rate of change DE obtained in the given loop is greater than that obtained before, it means that reliability of coincidence between two image information is higher at the zero cross point in the given loop than that of the previous zero cross point; accordingly, MA is changed to DE, ZR is changed to the value which is 1 bit prior to the shift amount corresponding to the zero cross point (CS-1), and JB is changed to the absolute value of the correlation value (LS) with the previous shifted amount in step S720. Thereafter, the process proceeds to step S721 and the correlation value LS which currently stores correlation value with the previous shifted amount is changed to the correlation value COR with the current shift amount.
In order to improve resolution in phase difference between two signal patterns, MA and JB are obtained to interpolate between the correlation values between which shifted amount crosses the y=0 coordinate line. The interpolation value H is represented by EQU H=JB/MA (2)
Whereas, if NO in step S716, S717 or S719, then the process proceeds to step S721, and the correlation value LS for storing the correlation value with the previous shifted amount is updated to the correlation value COR obtained at the current shifted amount, then the process proceeds to step S722.
The processes of steps S702 to S721 are operation to be performed for each shift amount, and these processes are repeated until the shift amount CS reaches the end shift amount SE (i.e., until SC=SE is determined in step S722).
Finally in step S724, the phase difference between the two signal patterns, PHASE, is obtained.
When the image information as shown in FIGS. 29A and 29B is obtained, by plotting correlation values obtained in accordance with the flowchart shown in FIG. 30, a graph as shown in FIG. 31 is obtained.
Referring to FIG. 31, the ordinate indicates correlation value, and the abscissa indicates relative shift amount of image information (unit: bit). In the graph, between shift amounts where the corresponding correlation values changes from a negative value to a positive value (i.e., where a zero cross point exists), there is a shift amount where the pair of the image information coincide with each other. Further, if there are more than one zero cross point, where the correlation value changes from a negative value to a positive value, the point where the rate of change in the correlation value is the greatest is determined as the point where the pair of the image information coincide. In the image information as shown in FIGS. 29A and 29B, the zero cross point exists between the shift amounts of 1 bit and 2 bits. By interpolating between the correlation values corresponding to the shift amounts of 1 bit and 2 bits, the phase difference between the pair of the image information is obtained. In this case, the phase difference is 1.5 bits, as shown in FIG. 31.
Although the phase difference is 1.5 bits as shown in FIG. 31, the shift range subjected to correlation operation does not end at 2 bits. This is because a plurality of zero cross points may exist, thus it is necessary to calculate correlation values for all the shift amounts within the predetermined shift range. Here, the shift range is the difference between the shifted amount where the last correlation operation is to be performed and the shifted amount where the first correlation operation is to be performed. The start shift amount and the end shift amount are determined on the basis of the distance B (not shown) between the optical axes of the first light-receiving lens 2801 and the second light-receiving lens 2802, shown in FIG. 28, focal length fj (not shown) of the first light-receiving lens 2801 and the second light-receiving lens 2802, pitch (not shown) of the photoelectric conversion elements of the first and second sensor arrays 2805 and 2806, and range of distance L (not shown) subjected to distance measuring operation, and the start shift amount and the end shift amount are determined on the basis of the following equations; EQU Start shift amount=(B.times.fj)/{maximum side of L) .times.p} EQU End shift amount=(B.times.fj)/{minimum side of L) .times.p} (3)
When B=5 mm, fj=10 mm, p=0.05 mm, and L=200 .about..infin., for instance, the equations (3) become, EQU Start shift amount=5.times.10/(.infin..times.0.05) .apprxeq.0[bit] EQU End shift amount=5.times.10/(200.times.0.05) .apprxeq.16.7[bits]
The end shift amount is 16.7 bits according to the above calculation, but this includes a possibility that a zero cross point may exists between the shift amounts of 16 bits and 17 bits. Accordingly, the end shift amount should be 17 bits. Therefore, under the above conditions, it is necessary to shift image information from 0 bit to 17 bits as performing correlation operation of calculating correlation values. In the flowchart shown in FIG. 30, processes of steps S702 to S723 are to be repeated 17 times.
Further, the number of pixels of a sensor array used in a distance measuring apparatus can be up to 60 in a case of high resolution sensor array; therefore, it requires considerable time for calculating correlation values. Referring to FIG. 30, when the number of pixels of a sensor array is 60, the processes of steps S707 to S714 are to be repeated 60 times in the largest case (j=0.about.cp, cp=NPX-.vertline.CS.vertline.-1=60-0-1), and 43 times in the least case (j=0-.about.cp, cp=NPX-.vertline.CS.vertline.-1=60-17-1).
For completing all the processes of steps S701 to S723, if about 22,000 commands in assembler language are used in a program for the processes and if it takes 0.5 msec to process each command, then it requires about 11 msec to process all the commands. This required processing time may be short for a distance measuring apparatus which performs one-point distance measurement; however, for a distance measuring apparatus of measuring distances of multiple points, e.g., five points, it takes 55 msec to perform these processes, which increases shutter operate time lag in a camera.
The overall operation of the distance measuring apparatus as shown in FIG. 28 is briefly explained with reference to FIG. 32. FIG. 32 shows an example of brief distance measuring operation performed by the distance measuring apparatus as shown in FIG. 28. Referring to FIG. 32, first in step S801, distance measuring operation is performed in the active mode. Then in step S802, whether or not the obtained result is reliable is determined on the basis of a result of comparison between the obtained distance to a predetermined distance or whether or not it is possible to perform calculation for determining reliability, for instance. If it is determined that the obtained result is reliable (YES in step S802), then the distance measuring process is completed; whereas if the reliability of the result is low (NO in step S802), then the process proceeds to step S803 and the passive mode is set so as to perform distance measuring operation in the passive mode without using the light-emitting element 2804.
In the distance measuring operation shown in FIG. 32, the distance measurement is first performed in the active mode which is suitable for measuring the distance to an object of low contrast at a short distance. For measuring of a distance to an object in the distance, which the active mode is not suitable for measuring, the distance to the object is measured once more in the passive mode after finishing the distance measuring operation in the active mode.
In the distance measuring apparatus as described above, it is possible to perform distance measurement using an identical algorithm both in the active mode using a light-emitting device and in the passive mode without using a light-emitting device, since the distance measurement is performed with the same devices and optical system, based on correlation between two image information in the both modes.
However, when an object is in the distance where the reliability of measurement in the active mode is low, the distance measuring operation in the active mode is determined improper and the distance measuring operation is performed for the second time in the passive mode which is often affected by conditions of the object, such as contrast of the object. For instance, in a case where the object to be measured has a repeated pattern, such as an iron barred fence, since the algorithm and the correlation shift range for calculating correlation values between the two image information used both in the active mode and in the passive mode are the same in the distance measuring operation as shown in FIG. 30 performed by the aforesaid distance measuring apparatus, there is a possibility that a plurality of zero cross points may be detected and a rate of change at one of the zero cross points which corresponds to a short distance may be the largest in the passive mode. In such a case, the detection result may indicate a short distance, which is a wrong result.
Further, in the passive mode, since the external light is converted into image signals, noise due to the external light (shot noise) is ignorable; however, the measuring performance depends upon the contrast of an object to be measured, thus, even though the object has contrast, if the distance to the object is short, the contrast of the image information obtained from the light-receiving devices becomes small, which deteriorates the distance measuring performance.
Thus, correlation operation between two image information of an object at a short distance in the passive mode may provide a wrong result, as well as is waste of processing time.
Furthermore, when measuring a distance to an object in the active mode with the aforesaid conventional distance measuring apparatus, light, emitted from a light-emitting device, is projected onto the object and the reflected light from the object forms an image on the sensors, and the charging time alters depending upon the strength of the reflected light from the object. When the object is at a very short distance, the sensors may be saturated. In such a case, the distance measuring operation is determined not realizable (NG) and the passive mode is set, then distance measuring operation in the passive mode is performed. This requires extra time for completing distance measuring processing. Moreover, there is a possibility that a wrong result may be obtained.